package com.cucn.ingmall.order.feign;

import com.cucn.common.utils.R;
import com.cucn.ingmall.order.to.WareSkuLockDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author KouChaoJie
 * @since: 2022/1/20 11:00
 */
@FeignClient("ingmall-ware")
public interface WareFeignService {
    /**
     * 判断sku是否有库存
     *
     * @param skuIds skuId集合
     */
    @PostMapping("/ware/waresku/hasstock")
    public R getSkusHasStock(@RequestBody List<Long> skuIds);

    /**
     * 获取收货地址信息及对应运费
     *
     * @param addrId 收货地址的id
     */
    @GetMapping("/ware/wareinfo/fare")
    public R getFare(@RequestParam("addrId") Long addrId);

    /**
     * 锁定sku库存数据
     */
    @PostMapping("/ware/waresku/lock/order")
    public R orderLockSkuWare(@RequestBody WareSkuLockDTO wareSkuLockDTO);
}
